/*
package com.common.zxing;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Camera;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;

import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import com.common.zxing.camera.CameraManager;
import com.common.zxing.decode.CaptureActivityHandler;
import com.common.zxing.view.ViewfinderView;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.RGBLuminanceSource;
import com.google.zxing.Result;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.QRCodeReader;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.List;
import java.util.Vector;




*/
/**
 * Initial the camera
 *
 * @author Ryan.Tang
 *//*

public class CaptureActivity1 extends Activity implements Callback {

    private static final int REQUEST_CODE_SCAN_GALLERY = 100;

    private CaptureActivityHandler handler;
    private ViewfinderView viewfinderView;
    private ImageView back;
    private boolean hasSurface;
    private Vector<BarcodeFormat> decodeFormats;
    private String characterSet;
    private InactivityTimer inactivityTimer;
    private MediaPlayer mediaPlayer;
    private boolean playBeep;
    private static final float BEEP_VOLUME = 0.10f;
    private boolean vibrate;
    private ProgressDialog mProgress;
    private String photo_path;
    private Bitmap scanBitmap;
    //	private Button cancelScanButton;
    public static final int RESULT_CODE_QR_SCAN = 0xA1;
    public static final String INTENT_EXTRA_KEY_QR_SCAN = "qr_scan_result";
    private Camera m_Camera;
    private Camera camera;
    private EditText editText;
    private boolean open = true;
    Handler handlers = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);

            String str = (String) msg.obj;

            switch (msg.what) {

                case 0:
                    Toast.makeText(CaptureActivity1.this, "失败-->" + str, Toast.LENGTH_LONG).show();
                    break;
                case 1:
                    Toast.makeText(CaptureActivity1.this, "成功-->" + str, Toast.LENGTH_LONG).show();
                    break;
            }

        }
    };
    private Date date;
    private Date dates;
    private List<QRCodeBind> list;
    private String qrCodeType;
    private String qrCode;
    private String qrCodeType1;
    private String stewardUserId;
    private String QRCodde;
    private String model;
    private long anchorId;
    private QRCodeSucces qrCodeSucces;
    private Toast toast;
    private boolean autoEnlarged = false;//是否具有自动放大功能(功能仅仅限扫描的是二维码，条形码不放大)

    */
/**
     * Called when the activity is first created.
     *//*

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scanner1);
        //        初始化闪光灯
        autoEnlarged = getIntent().getBooleanExtra("autoEnlarged",false);

        CameraManager.init(getApplication());
        viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_content);
        back = (ImageView) findViewById(R.id.scanner_toolbar_back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        hasSurface = false;
        inactivityTimer = new InactivityTimer(this);
        final ImageView img = (ImageView) findViewById(R.id.imgss);
        img.setOnClickListener(new View.OnClickListener() {
            @SuppressLint("ServiceCast")
            @Override
            public void onClick(View view) {
                if (open == true) {
                    img.setImageResource(R.drawable.closes);
                    CameraManager.get().openLight();
                    open = false;
                } else {
                    img.setImageResource(R.drawable.open);
                    CameraManager.get().offLight();
                    open = true;
                }

            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        //getMenuInflater().inflate(R.menu.scanner_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void onActivityResult(final int requestCode, int resultCode, Intent data) {
        //扫登录，没登录
        if (requestCode == 100 && resultCode == 500) {
            QRCodeLogins();
            finish();
        }
        //扫登录，没绑定手机号
        if (requestCode == 300 && resultCode == 400) {
            QRCodeLogins();
            finish();
        }
        //扫绑定，没登录
        if (requestCode == 700 && resultCode == 500) {
            QRCodeBind();
            finish();
        }
        //扫绑定，没手机号
        if (requestCode == 800 && resultCode == 400) {
            QRCodeBind();
            finish();
        }
        if (requestCode == RESULT_OK) {
            switch (requestCode) {
                case REQUEST_CODE_SCAN_GALLERY:
                    //获取选中图片的路径
                    Cursor cursor = getContentResolver().query(data.getData(), null, null, null, null);
                    if (cursor.moveToFirst()) {
                        photo_path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
                    }
                    cursor.close();

                    mProgress = new ProgressDialog(CaptureActivity1.this);
                    mProgress.setMessage("正在扫描...");
                    mProgress.setCancelable(false);
                    mProgress.show();

                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            Result result = scanningImage(photo_path);
                            if (result != null) {
                                Intent resultIntent = new Intent();
                                Bundle bundle = new Bundle();
                                bundle.putString(INTENT_EXTRA_KEY_QR_SCAN, result.getText());
//                                Logger.d("saomiao",result.getText());
//                                bundle.putParcelable("bitmap",result.get);
                                resultIntent.putExtras(bundle);
                                CaptureActivity1.this.setResult(RESULT_CODE_QR_SCAN, resultIntent);

                            } else {
                                Message m = handler.obtainMessage();
                                m.what = R.id.decode_failed;
                                m.obj = "Scan failed!";
                                handler.sendMessage(m);
                            }
                        }
                    }).start();
                    break;
            }
        }

        super.onActivityResult(requestCode, resultCode, data);
    }

    */
/**
     * 扫描二维码图片的方法
     *
     * @param path
     * @return
     *//*

    public Result scanningImage(String path) {
        if (TextUtils.isEmpty(path)) {
            return null;
        }
        Hashtable<DecodeHintType, String> hints = new Hashtable<>();
        hints.put(DecodeHintType.CHARACTER_SET, "UTF8"); //设置二维码内容的编码
        //返回图片选择器
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true; // 先获取原大小
        //通过图片工厂把图片解码
        scanBitmap = BitmapFactory.decodeFile(path, options);
        options.inJustDecodeBounds = false; // 获取新的大小
        int sampleSize = (int) (options.outHeight / (float) 200);
        if (sampleSize <= 0)
            sampleSize = 1;
        options.inSampleSize = sampleSize;
        scanBitmap = BitmapFactory.decodeFile(path, options);
        //设置亮度
        RGBLuminanceSource source = new RGBLuminanceSource(scanBitmap);
        BinaryBitmap bitmap1 = new BinaryBitmap(new HybridBinarizer(source));
        QRCodeReader reader = new QRCodeReader();
        try {
            return reader.decode(bitmap1, hints);
        } catch (NotFoundException e) {
            e.printStackTrace();
        } catch (ChecksumException e) {
            e.printStackTrace();
        } catch (FormatException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onResume() {
        super.onResume();
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.scanner_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        if (hasSurface) {
            initCamera(surfaceHolder);
        } else {
            surfaceHolder.addCallback(this);
            surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        }
        decodeFormats = null;
        characterSet = null;

        playBeep = true;
        AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
        if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
            playBeep = false;
        }
        initBeepSound();
        vibrate = true;
    }

    @Override
    protected void onPause() {
        super.onPause();
        if (handler != null) {
            handler.quitSynchronously();
            handler = null;
        }
        CameraManager.get().closeDriver();
    }

    @Override
    protected void onDestroy() {
        inactivityTimer.shutdown();
//                manager.turnOff();
        // 关闪光灯
        CameraManager.get().offLight();

        super.onDestroy();
    }

    */
/**
     * Handler scan result
     *
     * @param result
     * @param barcode
     *//*


    public void handleDecode(Result result, Bitmap barcode) {
        inactivityTimer.onActivity();
        playBeepSoundAndVibrate();
        String resultString = result.getText();
        //FIXME
        if (TextUtils.isEmpty(resultString)) {
            Toast.makeText(CaptureActivity1.this, "Scan failed!", Toast.LENGTH_SHORT).show();
        } else {
            try {
                Bundle bundle = new Bundle();
                bundle.putString(INTENT_EXTRA_KEY_QR_SCAN, resultString);
                Log.i("zzzzzzzzzzzz", resultString);
                if (resultString.length() < 10) {
                    toast = Toast.makeText(getApplicationContext(),
                            "您的扫描有误，请重新扫描", Toast.LENGTH_LONG);
                    toast.setGravity(Gravity.CENTER, 0, 0);
                    toast.show();
                    // Toast.makeText(getApplicationContext(), "您的扫描有误，请重新扫描", Toast.LENGTH_SHORT).show();
                    finish();
                } else {
                    if (resultString.contains("wd=")) {
                        final String substring = resultString.substring(resultString.indexOf("{"));
                        Log.i("aaaa", substring);
                        list = new ArrayList<>();
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                Gson gson = new Gson();
                                QRCodeBind qrCodeLogin = gson.fromJson(substring, QRCodeBind.class);
                                list.add(qrCodeLogin);
                            }
                        });

                        final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");

                        try{

                            //没获取成功 取本地的
                            Date curDate = new Date(System.currentTimeMillis());
                            String str = formatter.format(curDate);
                            date = formatter.parse(str);
                            dates = formatter.parse(list.get(0).getQRCodeExpire());


                        }catch (Exception e){

                        }

//                        final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                        //获取服务器时间
                        NetManager.request_User.GetCurrentTime(new onNetCallbackListener() {
                            @Override
                            public void onSuccess(String requestStr, String result) {
                                Log.i("获取当前时间", result);
                                Log.i("888888xx", requestStr);

                                try {

                                    Gson gson = new Gson();
                                    GetCurrentBean getCurrentBean = gson.fromJson(result, GetCurrentBean.class);
                                    if (getCurrentBean.getCode() == 200) {

                                        long sysdate = getCurrentBean.getAttribute().getSysdate();
                                        Log.i("1111fvvvvvvvvvvvv", "====" + sysdate );
                                        String currentTine = DateTimeTools.getX1(sysdate);

                                        long sysdate_b1 = DateTimeTools.getB1(currentTine);
                                        Log.i("2222fvvvvvvvvvvvv", "====" + sysdate_b1 );


                                        date = new Date(sysdate_b1);
                                        dates = formatter.parse(list.get(0).getQRCodeExpire());
                                        Log.i("aaaaaaaaa", "====" + date.getTime() + "-----" + dates.getTime());
                                        seeTime();
                                    } else {

                                        seeTime();
                                    }

                                } catch (Exception e) {
                                    seeTime();
                                }
                            }
                        });



                    } else {
                        //扫描其他的二维码的时候跳转到webview页面
                        Intent intent = new Intent(getApplicationContext(), WebViewActivity.class);
                        intent.putExtra(WebViewActivity.WEB_URL, resultString);
                        startActivity(intent);
                    }
                }
            } catch (RuntimeException e) {
                Log.e("logggggg", e.getMessage());
            }
        }
//            resultIntent.putExtras(bundle);
//            this.setResult(RESULT_CODE_QR_SCAN, resultIntent);

//        CaptureActivity.this.finish();

    }


    */
/**
     * 时间的判断
     *//*

    public void seeTime(){

        if (list.get(0).getQRCodeType().equals("gJLoginQRCode")) {
            if (date.getTime() <= dates.getTime()) {
//                        获取二维码类型
                qrCodeType = list.get(0).getQRCodeType();
//                        二维码的key
                qrCode = list.get(0).getQRCode();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        QRCodeLogins();

                    }
                });

            } else {
                startActivity(new Intent(getApplicationContext(), LoginErroyActivity.class));
                finish();
            }


        } else {
            if (date.getTime() <= dates.getTime()) {
                qrCodeType1 = list.get(0).getQRCodeType();
                stewardUserId = list.get(0).getStewardUserId();
                QRCodde = list.get(0).getQRCode();
//                      手机型号
                model = Build.MODEL;
//                    Log.i("xxxxxxx", this.anchorId + qrCodeType1 + model + QRCodde + stewardUserId);
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        QRCodeBind();

                    }
                });

            } else {
                startActivity(new Intent(getApplicationContext(), LoginErroyActivity.class));
                finish();
            }
        }


    }


    private void QRCodeBind() {
        try {
            anchorId = App.getAPPUserInfo().getUserInfoVo().getUserId();
        } catch (NullPointerException e) {

            Log.e("TAG", "这里报错了，acchorId等于默认值0");
            anchorId = 0;

        }
        Log.i("9999999999", anchorId + qrCodeType1 + model + QRCodde + stewardUserId);
        NetManager.request_User.Qrcode(anchorId, qrCodeType1, model, QRCodde, stewardUserId, new onNetCallbackListener() {
            @Override
            public void onSuccess(String requestStr, final String result) {
                Log.i("wwwwwwwww", requestStr);
                Log.i("wwwwwwwww", result);
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Gson gson = new Gson();
                        qrCodeSucces = gson.fromJson(result, QRCodeSucces.class);
                        if (qrCodeSucces.getCode() == 200) {
                            Intent intent = new Intent(getApplicationContext(), BindActivity.class);
                            intent.putExtra("qrCodeType", qrCodeType1);
                            intent.putExtra("qrCode", QRCodde);
                            intent.putExtra("stewardUserId", stewardUserId);
                            startActivity(intent);
                            finish();
                        } else if (qrCodeSucces.getCode() == 2350) {
                            Intent intents = new Intent(getApplicationContext(), LoginActivity.class);
                            startActivityForResult(intents, 700);

                        } else if (qrCodeSucces.getCode() == 2351) {
                            Intent intents = new Intent(getApplicationContext(), LoginActivity.class);
                            startActivityForResult(intents, 700);
                        } else if (qrCodeSucces.getCode() == 2352) {
                            Intent intents = new Intent(getApplicationContext(), BindPhoneActivity.class);
                            startActivityForResult(intents, 800);

                        } else if (qrCodeSucces.getCode() == 2353) {
                            startActivity(new Intent(getApplicationContext(), BindErroysActivity.class));
                            finish();
                        } else if (qrCodeSucces.getCode() == 2359) {
                            startActivity(new Intent(getApplicationContext(), BindFreezeActivity.class));
                            finish();
                        } else if (qrCodeSucces.getCode() == 2361) {
                            Intent it = new Intent(getApplicationContext(), BindErroysActivity.class);
                            it.putExtra("title", qrCodeSucces.getMessage());
                            startActivity(it);
                            finish();
                        } else if (qrCodeSucces.getCode() == 2360) {
                            Intent intent = new Intent(getApplicationContext(), BindAuthenticationActivity.class);
                            intent.putExtra("text", qrCodeSucces.getMessage());
                            startActivity(intent);
                            finish();
                        } else if (qrCodeSucces.getCode() == 2362) {
                            Intent it = new Intent(getApplicationContext(), BindErroyActivity.class);
                            it.putExtra("title", qrCodeSucces.getMessage());
                            startActivity(it);
                            finish();
                        } else if (qrCodeSucces.getCode() == 2365) {
                            Intent it2 = new Intent(getApplicationContext(), BindErroysActivity.class);
                            it2.putExtra("title", qrCodeSucces.getMessage());
                            startActivity(it2);
                            finish();
                        } else if (qrCodeSucces.getCode() == 2367) {
                            Intent itw = new Intent(getApplicationContext(), BindQRcodeErroyActivity.class);
                            itw.putExtra("title", qrCodeSucces.getMessage());
                            startActivity(itw);
                            finish();
                        } else {
                            Intent it = new Intent(getApplicationContext(), MainFragment1.class);
                            startActivity(it);
                            finish();
                        }

                    }
                });
            }
        });
    }

    private void QRCodeLogins() {
        try {
            anchorId = App.getAPPUserInfo().getUserInfoVo().getUserId();
        } catch (NullPointerException e) {

            Log.e("TAG", "这里报错了，acchorId等于默认值0");
            anchorId = 0;

        }
        NetManager.request_User.Qrcode(anchorId, qrCodeType, model, qrCode, "", new onNetCallbackListener() {
            @Override
            public void onSuccess(String requestStr, final String result) {
//                Log.i("555555555", "----------" + result.toString());
                Log.i("555555555", "----------" + requestStr.toString());
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Gson gson = new Gson();
                        qrCodeSucces = gson.fromJson(result, QRCodeSucces.class);
                        int code = qrCodeSucces.getCode();
                        if (code == 200) {
                            String experienceTime = qrCodeSucces.getAttribute().getExperienceTime();
                            if (experienceTime.equals("0")) {
                                Intent intent = new Intent(getApplicationContext(), RenewActivity.class);
                                intent.putExtra("qrCodeType", qrCodeType);
                                intent.putExtra("qrCode", qrCode);
                                intent.putExtra("experienceTime", experienceTime);
                                startActivity(intent);
                                finish();
                            } else {
                                Intent intent = new Intent(getApplicationContext(), ScancodeloginActivity.class);
                                intent.putExtra("qrCodeType", qrCodeType);
                                intent.putExtra("qrCode", qrCode);
                                intent.putExtra("experienceTime", experienceTime);
                                startActivity(intent);
                                finish();
                            }
                        } else if (code == 2350) {
                            Intent intents = new Intent(getApplicationContext(), LoginActivity.class);
                            startActivityForResult(intents, 100);
                        } else if (code == 2351) {
                            Intent intents = new Intent(getApplicationContext(), LoginActivity.class);
                            startActivityForResult(intents, 100);
                        } else if (code == 2352) {

                            Intent intent = new Intent(getApplicationContext(), BindPhoneActivity.class);
                            startActivityForResult(intent, 300);
                        } else if (code == 2353) {
                            Intent intent = new Intent(getApplicationContext(), BindPhoneActivity.class);
                            startActivityForResult(intent, 300);

                        } else if (code == 2359) {
                            Intent intent = new Intent(getApplicationContext(), BindFreezeActivity.class);
                            intent.putExtra("title", qrCodeSucces.getMessage());
                            startActivity(intent);
                            finish();
                        } else if (code == 2361) {
                            Intent it = new Intent(getApplicationContext(), BindErroysActivity.class);
                            it.putExtra("title", qrCodeSucces.getMessage());
                            startActivity(it);
                            finish();
                        } else if (code == 2366) {
                            Intent intent1 = new Intent(getApplicationContext(), BindErroysActivity.class);
                            intent1.putExtra("title", qrCodeSucces.getMessage());
                            startActivity(intent1);
                            finish();
                        } else if (code == 2365) {
                            Intent it2 = new Intent(getApplicationContext(), BindErroysActivity.class);
                            it2.putExtra("title", qrCodeSucces.getMessage());
                            startActivity(it2);
                            finish();
                        } else if (code == 2367) {
                            Intent itw = new Intent(getApplicationContext(), BindQRcodeErroyActivity.class);
                            itw.putExtra("title", qrCodeSucces.getMessage());
                            startActivity(itw);
                            finish();
                        } else {
                            toast = Toast.makeText(getApplicationContext(),
                                    "二维码扫描失败，请重新扫描", Toast.LENGTH_LONG);
                            toast.setGravity(Gravity.CENTER, 0, 0);
                            toast.show();
                            //Toast.makeText(getApplicationContext() , "二维码扫描失败，请重新扫描", Toast.LENGTH_SHORT).show();
                            Intent itw = new Intent(getApplicationContext(), MainFragment1.class);
                            startActivity(itw);
                            finish();
                        }

                    }
                });
            }
        });

    }

    private void initCamera(SurfaceHolder surfaceHolder) {
        try {
            CameraManager.get().openDriver(surfaceHolder);
        } catch (IOException ioe) {
            return;
        } catch (RuntimeException e) {
            return;
        }
        if (handler == null) {
            handler = new CaptureActivityHandler(CaptureActivity.this, decodeFormats, characterSet);
        }
    }

    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int width,
                               int height) {

    }

    @Override
    public void surfaceCreated(SurfaceHolder holder) {
        if (!hasSurface) {
            hasSurface = true;
            initCamera(holder);
        }

    }

    @Override
    public void surfaceDestroyed(SurfaceHolder holder) {
        hasSurface = false;

    }

    public ViewfinderView getViewfinderView() {
        return viewfinderView;
    }

    public Handler getHandler() {
        return handler;
    }

    public void drawViewfinder() {
        viewfinderView.drawViewfinder();

    }

    private void initBeepSound() {
        if (playBeep && mediaPlayer == null) {
            setVolumeControlStream(AudioManager.STREAM_MUSIC);
            mediaPlayer = new MediaPlayer();
            mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            mediaPlayer.setOnCompletionListener(beepListener);

            AssetFileDescriptor file = getResources().openRawResourceFd(
                    R.raw.beep);
            try {
                mediaPlayer.setDataSource(file.getFileDescriptor(),
                        file.getStartOffset(), file.getLength());
                file.close();
                mediaPlayer.setVolume(BEEP_VOLUME, BEEP_VOLUME);
                mediaPlayer.prepare();
            } catch (IOException e) {
                mediaPlayer = null;
            }
        }
    }

    private static final long VIBRATE_DURATION = 200L;

    private void playBeepSoundAndVibrate() {
        if (playBeep && mediaPlayer != null) {
            mediaPlayer.start();
        }
        if (vibrate) {
            //开启一个振动器
            //   Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
            // vibrator.vibrate(VIBRATE_DURATION);
            // Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
            Uri parse = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.qr_scan_code_sound);
            Ringtone rt = RingtoneManager.getRingtone(getApplicationContext(), parse);
            rt.play();

        }
    }

    */
/**
     * When the beep has finished playing, rewind to queue up another one.
     *//*

    private final MediaPlayer.OnCompletionListener beepListener = new MediaPlayer.OnCompletionListener() {
        public void onCompletion(MediaPlayer mediaPlayer) {
            mediaPlayer.seekTo(0);
        }
    };

    public boolean isAutoEnlarged() {
        return autoEnlarged;
    }

}



*/
